package com.hrsoft.modules.sys.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hrsoft.common.utils.PageUtils;
import com.hrsoft.common.utils.Query;

import com.hrsoft.modules.sys.dao.SysAreasJsonDao;
import com.hrsoft.modules.sys.entity.SysAreasJsonEntity;
import com.hrsoft.modules.sys.service.SysAreasJsonService;


@Service("sysAreasJsonService")
public class SysAreasJsonServiceImpl extends ServiceImpl<SysAreasJsonDao, SysAreasJsonEntity> implements SysAreasJsonService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SysAreasJsonEntity> page = this.page(
                new Query<SysAreasJsonEntity>().getPage(params),
                new QueryWrapper<SysAreasJsonEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public String getJsonContentByTypeCode(String typeCode) {
        QueryWrapper<SysAreasJsonEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("type_code", typeCode);
        SysAreasJsonEntity areasJson = this.getOne(wrapper, false);
        return areasJson.getJsonContent();
    }

}